import { RouteRecordRaw } from 'vue-router'

export const RouteView = () => import('@/layout/components/main/RouteView.vue')
/**
 * 定义动态路由
 */
export const dynamicRoutes: Array<RouteRecordRaw> = [
    {
        path: '/',
        name: '/',
        component: () => import('@/layout/index.vue'),
        redirect: '/home',
        meta: {
            isKeepAlive: true,
        },
        children: [
            {
                path: '/home',
                name: 'home',
                component: () => import('@/views/home/index.vue'),
                meta: {
                    title: 'message.router.home',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    isAffix: true,
                    isIframe: false,
                    roles: ['ADMIN', 'common'],
                    icon: 'iconfont icon-shouye',
                },
            },
            {
                path: '/system',
                name: 'system',
                component: RouteView,
                redirect: '/system/menu',
                meta: {
                    title: 'message.router.system',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    isAffix: false,
                    isIframe: false,
                    roles: ['ADMIN', 'common'],
                    icon: 'iconfont icon-xitongshezhi',
                },
                children: [
                    {
                        path: '/system/user',
                        name: 'systemUser',
                        component: () => import('@/views/system/user/index.vue'),
                        meta: {
                            title: 'message.router.systemUser',
                            isLink: '',
                            isHide: false,
                            isKeepAlive: true,
                            isAffix: false,
                            isIframe: false,
                            roles: ['ADMIN', 'common'],
                            icon: 'iconfont icon-icon-',
                        },
                    },
                    {
                        path: '/system/role',
                        name: 'systemRole',
                        component: () => import('@/views/system/role/index.vue'),
                        meta: {
                            title: 'message.router.systemRole',
                            isLink: '',
                            isHide: false,
                            isKeepAlive: true,
                            isAffix: false,
                            isIframe: false,
                            roles: ['ADMIN', 'common'],
                            icon: 'ele-ColdDrink',
                        },
                    },
                    {
                        path: '/system/dept',
                        name: 'systemDept',
                        component: () => import('@/views/system/dept/index.vue'),
                        meta: {
                            title: 'message.router.systemDept',
                            isLink: '',
                            isHide: false,
                            isKeepAlive: true,
                            isAffix: false,
                            isIframe: false,
                            roles: ['ADMIN', 'common'],
                            icon: 'ele-OfficeBuilding',
                        },
                    },
                    {
                        path: '/system/menu',
                        name: 'systemMenu',
                        component: () => import('@/views/system/menu/index.vue'),
                        meta: {
                            title: 'message.router.systemMenu',
                            isLink: '',
                            isHide: false,
                            isKeepAlive: true,
                            isAffix: false,
                            isIframe: false,
                            roles: ['ADMIN', 'common'],
                            icon: 'iconfont icon-caidan',
                        },
                    },
                    {
                        path: '/system/dict',
                        name: 'systemDict',
                        component: () => import('@/views/system/dict/index.vue'),
                        meta: {
                            title: 'message.router.systemDic',
                            isLink: '',
                            isHide: false,
                            isKeepAlive: true,
                            isAffix: false,
                            isIframe: false,
                            roles: ['ADMIN', 'common'],
                            icon: 'ele-OfficeBuilding',
                        },
                    },
                ],
            },
            {
                path: '/iframe',
                name: 'iframe',
                component: () => import('@/layout/components/main/index.vue'),
                meta: {
                    title: 'message.router.iframe',
                    isLink: '',
                    isHide: false,
                    isKeepAlive: true,
                    isAffix: true,
                    isIframe: true,
                    roles: ['ADMIN', 'common'],
                    icon: 'iconfont icon-shouye',
                    url: 'https://undraw.co/illustrations',
                },
            },
        ],
    },
]

/**
 * 定义静态路由（默认路由，一般不进行修改，不做权限控制）
 */
export const staticRoutes: Array<RouteRecordRaw> = [
    {
        path: '/login',
        name: 'login',
        component: () => import('@/views/login/index.vue'),
        meta: {
            title: '登录',
        },
    },
]

/**
 * 定义404、401界面
 */
export const notFoundAndNoPower = [
    {
        path: '/:path(.*)*',
        name: 'notFound',
        component: () => import('@/views/error/404.vue'),
        meta: {
            title: 'message.staticRoutes.notFound',
            hidden: true,
        },
    },
    {
        path: '/401',
        name: 'noPower',
        component: () => import('@/views/error/401.vue'),
        meta: {
            title: 'message.staticRoutes.noPower',
            hidden: true,
        },
    },
]
